<div class="tpl-content-page-title">添加订单</div>
<ol class="am-breadcrumb">
	<li><a href="#" class="am-icon-home">首页</a></li>
	<li><a href="#">云造型会员</a></li>
	<li class="am-active">添加订单</li>
</ol>
<div class="tpl-portlet-components">
	<div class="portlet-title">
		<div class="caption font-green bold">
			<!-- <span class="am-icon-code"></span> 表单 -->
		</div>
		<div class="tpl-portlet-input tpl-fz-ml">
			<div class="portlet-input input-small input-inline">
				<div class="input-icon right">
				<!-- 	<i class="am-icon-search"></i> <input type="text"
						class="form-control form-control-solid" placeholder="搜索..."> -->
				</div>
			</div>
		</div>


	</div>
	<div class="tpl-block ">

		<div class="am-g tpl-amazeui-form">

			<div class="am-u-sm-12 am-u-md-9">
				<form class="am-form am-form-horizontal">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">商品名称
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="item-name">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-phone" class="am-u-sm-3 am-form-label">商品价格</label>
						<div class="am-u-sm-9">
							<input type="tel" id="item-price">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-QQ" class="am-u-sm-3 am-form-label">设计师</label>
						<div class="am-u-sm-9">
							<input type="text" id="designerId">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-email" class="am-u-sm-3 am-form-label">会员名称
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-name" readonly="readonly"> 
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">手机号码</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-mobile" readonly="readonly"> 
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">付款方式</label>
						<div class="am-u-sm-9">
							<input type="text" id="pay-type" readonly="readonly">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">账户余额</label>
						<div class="am-u-sm-9">
							<input type="text" id="accountId" readonly="readonly">
						</div>
					</div> 
					
					<!-- <div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">付款时间</label>
						<div class="am-u-sm-9">
							<input type="text" id="pay-time" readonly="true">
						</div>
					</div> -->
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<button type="button" class="am-btn am-btn-cancel">返回订单</button>
							<button type="button" class="am-btn am-btn-pay">提交订单</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(function(){ 
		 doInitOrderInfo() 
		 $(".tpl-content-wrapper").on("click",".am-btn-cancel",doCancel)
		
		 
		 $(".am-btn-pay").click(doSaveOrderInfo)
	})
	
	 // 保存订单信息
	function doSaveOrderInfo(){
		 debugger
		 //1.url
		 var insertUrl="order/doSaveObject";
		 //2.获取表单数据
		 var params=doGetEditFormData();
		 //3.发起异步请求
		 $.post(insertUrl,params,function(result){
			 if(result.state==1){
				 alert(result.message);
				 doCancel();
			 }else{
				 alert(result.message);
			 }
		 })
	 } 
	
	// 获取用户输入的表单数据
	function doGetEditFormData(){
		debugger
		 var params={
		      "itemName":$("#item-name").val(),
		      "itemPrice":$("#item-price").val(),
		      "designer":$("#designerId").val(),
		      
		      "memberName":$("#member-name").val(),
	          "memberMobile":$("#member-mobile").val(),
	          "payType":$("#pay-type").val(),
	          "account":$("#accountId").val()
	          }
		return params;
	} 
	
 	// 初始化页面数据
    function doInitOrderInfo(data){
		var data=$(".tpl-content-wrapper").data("data");
		
		$("#member-name").val(data.memberName);
		$("#member-mobile").val(data.mobile); 
		$("#pay-type").val("余额付款");
		$("#accountId").val(data.account);  // 余额
	} 
	
	
	 // 返回订单页面
	function doCancel(){
		$(".tpl-content-wrapper").load("member-info.html");
	}
	
	
	
</script>








